<?php
    /*
        Template Name: Homepage
    */
?>
<?php get_header(); ?>
			<div id="content">
				<div class="block">
					<?php if (have_posts()) : ?>
						<?php while (have_posts()) : the_post(); ?>
							<?php the_content(); ?>
						<?php endwhile; ?>
						<?php wp_pagenavi(); ?>
					<?php else : ?>
						<h2>Упс</h2>
						<p>Извините, но такой странички не существует.</p>
					<?php endif; ?>
				</div>
				<div class="column_wpap">
					<div class="column">
						<div class="block">
							<h2><a href="<?php bloginfo('home') ?>/category/news/">Новости</a></h2>
							<ul>
								<?php 
									$c_query = new WP_Query('showposts=8&orderby=date&order=desc&category_name=news');
										if ($c_query->have_posts()) :
								?>
									<?php  while ($c_query->have_posts()) : $c_query->the_post(); ?>
										<li>
											<strong><a title="<?php the_title(); ?>" href="<?php echo get_permalink(); ?>"><?php the_title(); ?></a></strong>
										</li>
									<?php endwhile //have posts ?>
								<?php endif //have posts ?>
							</ul>
						</div>
					</div>
					<div class="column">
						<div class="block">
							<h2><a href="<?php bloginfo('home') ?>/category/html-css-faq/">Справочник</a></h2>
							<ul>
								<?php 
									$c_query = new WP_Query('showposts=8&orderby=date&order=desc&category_name=html-css-faq');
										if ($c_query->have_posts()) :
								?>
									<?php  while ($c_query->have_posts()) : $c_query->the_post(); ?>
										<li>
											<strong><a title="<?php the_title(); ?>" href="<?php echo get_permalink(); ?>"><?php the_title(); ?></a></strong>
										</li>
									<?php endwhile //have posts ?>
								<?php endif //have posts ?>
							</ul>
						</div>
					</div>
					<div class="sidebar">
						<div class="block">
							<h2><a href="<?php bloginfo('home') ?>/forum/">Форум Html Css</a></h2>
							<?php if ( !function_exists('dynamic_sidebar')
								|| !dynamic_sidebar('Home Block') ) : ?>
							<?php endif; ?>
						</div>
					</div>
				</div>
			</div>
<?php get_footer(); ?>